"""
@file : homework
@author : wujiaxi
@Date : 2021/7/27

"""
import requests
import re

web = requests.get("https://www.sanchuangedu.cn/")

match_text = web.text

reg = re.findall(r"(?<=src=\").+(?=\" alt)|(?<=url\().+(?=\);\">)",match_text)

image_nums = len(reg)
print(f"一共{image_nums}张图片")

j = 0
for i in reg:
    pic = requests.get("https://www.sanchuangedu.cn/" + i)
    picture = pic.content
    j += 1

    with open(rf"E:\雪山飞狐\python\图{j}.jpg","wb+") as fp:
        fp.write(picture)

#作业二

import re

def main():


    msg = "san chuang tong le, welcom, 'hello world',learn python"
    ret = re.findall(r"(?<=\')[A-Za-z]+\s[A-Za-z]+(?=\')|[A-Za-z]+",msg)
    print(ret)

if __name__  == '__main__':
    main()